/**
* @Title: institution_detail_ctrl.js
* @Description: TODO
* Copyright: Copyright (c) 2014 
 * Company:中国平安
*
* @Project HIMS-FWA
* @author EX-chenyonghong001
* @date 2014年10月17日 下午2:38:47
* @version V1.0
*/
;
(function(){
	'use strict';
	
	var app = angular.module('fwa.mainApp');
	app.controller('doctorInfoDetailCtrl', ['$scope','CommunityService','$http','$modal','$state','$stateParams','doctorInfoService','BaseURL','Modal',
	                                function($scope,CommunityService,$http,$modal,$state,$stateParams,doctorInfoService,baseUrl,Modal){
	     $scope.UrlParams = $stateParams;
	     $scope.communityService = CommunityService;
	     CommunityService.getBaseCode('{codeType:\'provincialDep\'}');
	     CommunityService.getBaseCode('{codeType:\'sex\'}');
	     CommunityService.getBaseCode('{codeType:\'cityDep\'}');
		 CommunityService.getBaseCode('{codeType:\'personTypeHos\'}');
		 CommunityService.getBaseCode('{codeType:\'personTypeShop\'}');
		 CommunityService.getBaseCode('{codeType:\'jobType\'}');
		 CommunityService.getBaseCode('{codeType:\'id_type\'}');
		 CommunityService.getBaseCode('{codeType:\'qualifiedLev\'}');
		 CommunityService.getBaseCode('{codeType:\'workScope\'}');
		 $scope.type =  $scope.UrlParams.type;
		 $scope.doctorId =   $scope.UrlParams.doctorId;
		 $scope.doctorInfoDetail = {};
         var departNo = "";
         var jobAdder = "";
         var jobAdder2 = "";
         var qualifiedLevel = "";
         var serviceStus = "";
         $scope.doctorInfoDetail.checkInstitutionRows = doctorInfoService.checkInstitutionRows;
		 if($scope.doctorId){
             $http({
                 method : 'GET',
                 cache : false,
                 url : baseUrl + '/hcp/hcp/insurance/show.do',
                 params : {
                     id : $scope.doctorId
                 }
             }).success(function(response, status, headers, config) {
                 $scope.doctorInfoDetail = response.result;
                  departNo =  $scope.doctorInfoDetail.departNo;
                  jobAdder =  $scope.doctorInfoDetail.jobAdder;
                  jobAdder2 =  $scope.doctorInfoDetail.jobAdder2;
                  qualifiedLevel =  $scope.doctorInfoDetail.qualifiedLevel;
                  serviceStus =  $scope.doctorInfoDetail.serviceStus;
                  $scope.doctorInfoDetail.checkInstitutionRows = $scope.doctorInfoDetail.institutionList;
                  doctorInfoService.checkInstitutionRows = $scope.doctorInfoDetail.institutionList;
             });
		 }
		
		
		$scope.cancel = function(){
			$state.go('institutionInfo.doctorInfoDetail',{
				providerid:"",
				type:0
    		});
		}
		$scope.checkRows = {};
		 $scope.deleteJobAddr = function (){
			 
		 }
		 $scope.check = function (providerId,e){
		 }
		 
        $scope.addJobAddr = function (doctorId){
		    var modalInstance = $modal.open({
		      templateUrl: baseUrl+'views/hcpms/institution/queryInstitution_list.html',
		      backdrop:'static',
			  size:'sm',
			  controller: 'queryInstitutionListCtrl'
		    });
		    modalInstance.result.then(function (selectedItem) {
		    });
		
        }
		$scope.back = function(){
			$state.go('insurance.insuranceList');
		}
        
        
    	//$scope.onSubmit();
	}
	]);
})();